<?php
	/**
	 * The abstract MantisUserPrefTableGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the MantisUserPrefTable subclass which
	 * extends this MantisUserPrefTableGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the MantisUserPrefTable class.
	 *
	 * @package My QCubed Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserId the value for intUserId (Not Null)
	 * @property integer $ProjectId the value for intProjectId (Not Null)
	 * @property integer $DefaultProfile the value for intDefaultProfile (Not Null)
	 * @property integer $DefaultProject the value for intDefaultProject (Not Null)
	 * @property integer $RefreshDelay the value for intRefreshDelay (Not Null)
	 * @property integer $RedirectDelay the value for intRedirectDelay (Not Null)
	 * @property string $BugnoteOrder the value for strBugnoteOrder (Not Null)
	 * @property integer $EmailOnNew the value for intEmailOnNew (Not Null)
	 * @property integer $EmailOnAssigned the value for intEmailOnAssigned (Not Null)
	 * @property integer $EmailOnFeedback the value for intEmailOnFeedback (Not Null)
	 * @property integer $EmailOnResolved the value for intEmailOnResolved (Not Null)
	 * @property integer $EmailOnClosed the value for intEmailOnClosed (Not Null)
	 * @property integer $EmailOnReopened the value for intEmailOnReopened (Not Null)
	 * @property integer $EmailOnBugnote the value for intEmailOnBugnote (Not Null)
	 * @property integer $EmailOnStatus the value for intEmailOnStatus (Not Null)
	 * @property integer $EmailOnPriority the value for intEmailOnPriority (Not Null)
	 * @property integer $EmailOnPriorityMinSeverity the value for intEmailOnPriorityMinSeverity (Not Null)
	 * @property integer $EmailOnStatusMinSeverity the value for intEmailOnStatusMinSeverity (Not Null)
	 * @property integer $EmailOnBugnoteMinSeverity the value for intEmailOnBugnoteMinSeverity (Not Null)
	 * @property integer $EmailOnReopenedMinSeverity the value for intEmailOnReopenedMinSeverity (Not Null)
	 * @property integer $EmailOnClosedMinSeverity the value for intEmailOnClosedMinSeverity (Not Null)
	 * @property integer $EmailOnResolvedMinSeverity the value for intEmailOnResolvedMinSeverity (Not Null)
	 * @property integer $EmailOnFeedbackMinSeverity the value for intEmailOnFeedbackMinSeverity (Not Null)
	 * @property integer $EmailOnAssignedMinSeverity the value for intEmailOnAssignedMinSeverity (Not Null)
	 * @property integer $EmailOnNewMinSeverity the value for intEmailOnNewMinSeverity (Not Null)
	 * @property integer $EmailBugnoteLimit the value for intEmailBugnoteLimit (Not Null)
	 * @property string $Language the value for strLanguage (Not Null)
	 * @property string $Timezone the value for strTimezone (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class MantisUserPrefTableGen extends QBaseClass implements IteratorAggregate {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////

		/**
		 * Protected member variable that maps to the database PK Identity column mantis_user_pref_table.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.user_id
		 * @var integer intUserId
		 */
		protected $intUserId;
		const UserIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.project_id
		 * @var integer intProjectId
		 */
		protected $intProjectId;
		const ProjectIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.default_profile
		 * @var integer intDefaultProfile
		 */
		protected $intDefaultProfile;
		const DefaultProfileDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.default_project
		 * @var integer intDefaultProject
		 */
		protected $intDefaultProject;
		const DefaultProjectDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.refresh_delay
		 * @var integer intRefreshDelay
		 */
		protected $intRefreshDelay;
		const RefreshDelayDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.redirect_delay
		 * @var integer intRedirectDelay
		 */
		protected $intRedirectDelay;
		const RedirectDelayDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.bugnote_order
		 * @var string strBugnoteOrder
		 */
		protected $strBugnoteOrder;
		const BugnoteOrderMaxLength = 4;
		const BugnoteOrderDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_new
		 * @var integer intEmailOnNew
		 */
		protected $intEmailOnNew;
		const EmailOnNewDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_assigned
		 * @var integer intEmailOnAssigned
		 */
		protected $intEmailOnAssigned;
		const EmailOnAssignedDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_feedback
		 * @var integer intEmailOnFeedback
		 */
		protected $intEmailOnFeedback;
		const EmailOnFeedbackDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_resolved
		 * @var integer intEmailOnResolved
		 */
		protected $intEmailOnResolved;
		const EmailOnResolvedDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_closed
		 * @var integer intEmailOnClosed
		 */
		protected $intEmailOnClosed;
		const EmailOnClosedDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_reopened
		 * @var integer intEmailOnReopened
		 */
		protected $intEmailOnReopened;
		const EmailOnReopenedDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_bugnote
		 * @var integer intEmailOnBugnote
		 */
		protected $intEmailOnBugnote;
		const EmailOnBugnoteDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_status
		 * @var integer intEmailOnStatus
		 */
		protected $intEmailOnStatus;
		const EmailOnStatusDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_priority
		 * @var integer intEmailOnPriority
		 */
		protected $intEmailOnPriority;
		const EmailOnPriorityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_priority_min_severity
		 * @var integer intEmailOnPriorityMinSeverity
		 */
		protected $intEmailOnPriorityMinSeverity;
		const EmailOnPriorityMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_status_min_severity
		 * @var integer intEmailOnStatusMinSeverity
		 */
		protected $intEmailOnStatusMinSeverity;
		const EmailOnStatusMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_bugnote_min_severity
		 * @var integer intEmailOnBugnoteMinSeverity
		 */
		protected $intEmailOnBugnoteMinSeverity;
		const EmailOnBugnoteMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_reopened_min_severity
		 * @var integer intEmailOnReopenedMinSeverity
		 */
		protected $intEmailOnReopenedMinSeverity;
		const EmailOnReopenedMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_closed_min_severity
		 * @var integer intEmailOnClosedMinSeverity
		 */
		protected $intEmailOnClosedMinSeverity;
		const EmailOnClosedMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_resolved_min_severity
		 * @var integer intEmailOnResolvedMinSeverity
		 */
		protected $intEmailOnResolvedMinSeverity;
		const EmailOnResolvedMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_feedback_min_severity
		 * @var integer intEmailOnFeedbackMinSeverity
		 */
		protected $intEmailOnFeedbackMinSeverity;
		const EmailOnFeedbackMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_assigned_min_severity
		 * @var integer intEmailOnAssignedMinSeverity
		 */
		protected $intEmailOnAssignedMinSeverity;
		const EmailOnAssignedMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_on_new_min_severity
		 * @var integer intEmailOnNewMinSeverity
		 */
		protected $intEmailOnNewMinSeverity;
		const EmailOnNewMinSeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.email_bugnote_limit
		 * @var integer intEmailBugnoteLimit
		 */
		protected $intEmailBugnoteLimit;
		const EmailBugnoteLimitDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.language
		 * @var string strLanguage
		 */
		protected $strLanguage;
		const LanguageMaxLength = 32;
		const LanguageDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_user_pref_table.timezone
		 * @var string strTimezone
		 */
		protected $strTimezone;
		const TimezoneMaxLength = 32;
		const TimezoneDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////



		/**
		 * Initialize each property with default values from database definition
		 */
		public function Initialize()
		{
			$this->intId = MantisUserPrefTable::IdDefault;
			$this->intUserId = MantisUserPrefTable::UserIdDefault;
			$this->intProjectId = MantisUserPrefTable::ProjectIdDefault;
			$this->intDefaultProfile = MantisUserPrefTable::DefaultProfileDefault;
			$this->intDefaultProject = MantisUserPrefTable::DefaultProjectDefault;
			$this->intRefreshDelay = MantisUserPrefTable::RefreshDelayDefault;
			$this->intRedirectDelay = MantisUserPrefTable::RedirectDelayDefault;
			$this->strBugnoteOrder = MantisUserPrefTable::BugnoteOrderDefault;
			$this->intEmailOnNew = MantisUserPrefTable::EmailOnNewDefault;
			$this->intEmailOnAssigned = MantisUserPrefTable::EmailOnAssignedDefault;
			$this->intEmailOnFeedback = MantisUserPrefTable::EmailOnFeedbackDefault;
			$this->intEmailOnResolved = MantisUserPrefTable::EmailOnResolvedDefault;
			$this->intEmailOnClosed = MantisUserPrefTable::EmailOnClosedDefault;
			$this->intEmailOnReopened = MantisUserPrefTable::EmailOnReopenedDefault;
			$this->intEmailOnBugnote = MantisUserPrefTable::EmailOnBugnoteDefault;
			$this->intEmailOnStatus = MantisUserPrefTable::EmailOnStatusDefault;
			$this->intEmailOnPriority = MantisUserPrefTable::EmailOnPriorityDefault;
			$this->intEmailOnPriorityMinSeverity = MantisUserPrefTable::EmailOnPriorityMinSeverityDefault;
			$this->intEmailOnStatusMinSeverity = MantisUserPrefTable::EmailOnStatusMinSeverityDefault;
			$this->intEmailOnBugnoteMinSeverity = MantisUserPrefTable::EmailOnBugnoteMinSeverityDefault;
			$this->intEmailOnReopenedMinSeverity = MantisUserPrefTable::EmailOnReopenedMinSeverityDefault;
			$this->intEmailOnClosedMinSeverity = MantisUserPrefTable::EmailOnClosedMinSeverityDefault;
			$this->intEmailOnResolvedMinSeverity = MantisUserPrefTable::EmailOnResolvedMinSeverityDefault;
			$this->intEmailOnFeedbackMinSeverity = MantisUserPrefTable::EmailOnFeedbackMinSeverityDefault;
			$this->intEmailOnAssignedMinSeverity = MantisUserPrefTable::EmailOnAssignedMinSeverityDefault;
			$this->intEmailOnNewMinSeverity = MantisUserPrefTable::EmailOnNewMinSeverityDefault;
			$this->intEmailBugnoteLimit = MantisUserPrefTable::EmailBugnoteLimitDefault;
			$this->strLanguage = MantisUserPrefTable::LanguageDefault;
			$this->strTimezone = MantisUserPrefTable::TimezoneDefault;
		}


		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a MantisUserPrefTable from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisUserPrefTable
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return MantisUserPrefTable::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::MantisUserPrefTable()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all MantisUserPrefTables
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisUserPrefTable[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call MantisUserPrefTable::QueryArray to perform the LoadAll query
			try {
				return MantisUserPrefTable::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all MantisUserPrefTables
		 * @return int
		 */
		public static function CountAll() {
			// Call MantisUserPrefTable::QueryCount to perform the CountAll query
			return MantisUserPrefTable::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = MantisUserPrefTable::GetDatabase();

			// Create/Build out the QueryBuilder object with MantisUserPrefTable-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'mantis_user_pref_table');
			MantisUserPrefTable::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('mantis_user_pref_table');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single MantisUserPrefTable object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return MantisUserPrefTable the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = MantisUserPrefTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query, Get the First Row, and Instantiate a new MantisUserPrefTable object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = MantisUserPrefTable::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;
				}
				if (count($objToReturn)) {
					// Since we only want the object to return, lets return the object and not the array.
					return $objToReturn[0];
				} else {
					return null;
				}
			} else {
				// No expands just return the first row
				$objDbRow = $objDbResult->GetNextRow();
				if(null === $objDbRow)
					return null;
				return MantisUserPrefTable::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
		}

		/**
		 * Static Qcubed Query method to query for an array of MantisUserPrefTable objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return MantisUserPrefTable[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = MantisUserPrefTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return MantisUserPrefTable::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of MantisUserPrefTable objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = MantisUserPrefTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = MantisUserPrefTable::GetDatabase();

			$strQuery = MantisUserPrefTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);

			$objCache = new QCache('qquery/mantisuserpreftable', $strQuery);
			$cacheData = $objCache->GetData();

			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = MantisUserPrefTable::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}

			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this MantisUserPrefTable
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'mantis_user_pref_table';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id', $strAliasPrefix . 'user_id');
			$objBuilder->AddSelectItem($strTableName, 'project_id', $strAliasPrefix . 'project_id');
			$objBuilder->AddSelectItem($strTableName, 'default_profile', $strAliasPrefix . 'default_profile');
			$objBuilder->AddSelectItem($strTableName, 'default_project', $strAliasPrefix . 'default_project');
			$objBuilder->AddSelectItem($strTableName, 'refresh_delay', $strAliasPrefix . 'refresh_delay');
			$objBuilder->AddSelectItem($strTableName, 'redirect_delay', $strAliasPrefix . 'redirect_delay');
			$objBuilder->AddSelectItem($strTableName, 'bugnote_order', $strAliasPrefix . 'bugnote_order');
			$objBuilder->AddSelectItem($strTableName, 'email_on_new', $strAliasPrefix . 'email_on_new');
			$objBuilder->AddSelectItem($strTableName, 'email_on_assigned', $strAliasPrefix . 'email_on_assigned');
			$objBuilder->AddSelectItem($strTableName, 'email_on_feedback', $strAliasPrefix . 'email_on_feedback');
			$objBuilder->AddSelectItem($strTableName, 'email_on_resolved', $strAliasPrefix . 'email_on_resolved');
			$objBuilder->AddSelectItem($strTableName, 'email_on_closed', $strAliasPrefix . 'email_on_closed');
			$objBuilder->AddSelectItem($strTableName, 'email_on_reopened', $strAliasPrefix . 'email_on_reopened');
			$objBuilder->AddSelectItem($strTableName, 'email_on_bugnote', $strAliasPrefix . 'email_on_bugnote');
			$objBuilder->AddSelectItem($strTableName, 'email_on_status', $strAliasPrefix . 'email_on_status');
			$objBuilder->AddSelectItem($strTableName, 'email_on_priority', $strAliasPrefix . 'email_on_priority');
			$objBuilder->AddSelectItem($strTableName, 'email_on_priority_min_severity', $strAliasPrefix . 'email_on_priority_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_status_min_severity', $strAliasPrefix . 'email_on_status_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_bugnote_min_severity', $strAliasPrefix . 'email_on_bugnote_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_reopened_min_severity', $strAliasPrefix . 'email_on_reopened_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_closed_min_severity', $strAliasPrefix . 'email_on_closed_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_resolved_min_severity', $strAliasPrefix . 'email_on_resolved_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_feedback_min_severity', $strAliasPrefix . 'email_on_feedback_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_assigned_min_severity', $strAliasPrefix . 'email_on_assigned_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_on_new_min_severity', $strAliasPrefix . 'email_on_new_min_severity');
			$objBuilder->AddSelectItem($strTableName, 'email_bugnote_limit', $strAliasPrefix . 'email_bugnote_limit');
			$objBuilder->AddSelectItem($strTableName, 'language', $strAliasPrefix . 'language');
			$objBuilder->AddSelectItem($strTableName, 'timezone', $strAliasPrefix . 'timezone');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a MantisUserPrefTable from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this MantisUserPrefTable::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return MantisUserPrefTable
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the MantisUserPrefTable object
			$objToReturn = new MantisUserPrefTable();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id'] : $strAliasPrefix . 'user_id';
			$objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'project_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'project_id'] : $strAliasPrefix . 'project_id';
			$objToReturn->intProjectId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'default_profile', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'default_profile'] : $strAliasPrefix . 'default_profile';
			$objToReturn->intDefaultProfile = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'default_project', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'default_project'] : $strAliasPrefix . 'default_project';
			$objToReturn->intDefaultProject = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'refresh_delay', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'refresh_delay'] : $strAliasPrefix . 'refresh_delay';
			$objToReturn->intRefreshDelay = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'redirect_delay', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'redirect_delay'] : $strAliasPrefix . 'redirect_delay';
			$objToReturn->intRedirectDelay = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'bugnote_order', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'bugnote_order'] : $strAliasPrefix . 'bugnote_order';
			$objToReturn->strBugnoteOrder = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_new', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_new'] : $strAliasPrefix . 'email_on_new';
			$objToReturn->intEmailOnNew = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_assigned', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_assigned'] : $strAliasPrefix . 'email_on_assigned';
			$objToReturn->intEmailOnAssigned = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_feedback', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_feedback'] : $strAliasPrefix . 'email_on_feedback';
			$objToReturn->intEmailOnFeedback = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_resolved', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_resolved'] : $strAliasPrefix . 'email_on_resolved';
			$objToReturn->intEmailOnResolved = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_closed', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_closed'] : $strAliasPrefix . 'email_on_closed';
			$objToReturn->intEmailOnClosed = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_reopened', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_reopened'] : $strAliasPrefix . 'email_on_reopened';
			$objToReturn->intEmailOnReopened = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_bugnote', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_bugnote'] : $strAliasPrefix . 'email_on_bugnote';
			$objToReturn->intEmailOnBugnote = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_status'] : $strAliasPrefix . 'email_on_status';
			$objToReturn->intEmailOnStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_priority', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_priority'] : $strAliasPrefix . 'email_on_priority';
			$objToReturn->intEmailOnPriority = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_priority_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_priority_min_severity'] : $strAliasPrefix . 'email_on_priority_min_severity';
			$objToReturn->intEmailOnPriorityMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_status_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_status_min_severity'] : $strAliasPrefix . 'email_on_status_min_severity';
			$objToReturn->intEmailOnStatusMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_bugnote_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_bugnote_min_severity'] : $strAliasPrefix . 'email_on_bugnote_min_severity';
			$objToReturn->intEmailOnBugnoteMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_reopened_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_reopened_min_severity'] : $strAliasPrefix . 'email_on_reopened_min_severity';
			$objToReturn->intEmailOnReopenedMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_closed_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_closed_min_severity'] : $strAliasPrefix . 'email_on_closed_min_severity';
			$objToReturn->intEmailOnClosedMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_resolved_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_resolved_min_severity'] : $strAliasPrefix . 'email_on_resolved_min_severity';
			$objToReturn->intEmailOnResolvedMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_feedback_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_feedback_min_severity'] : $strAliasPrefix . 'email_on_feedback_min_severity';
			$objToReturn->intEmailOnFeedbackMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_assigned_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_assigned_min_severity'] : $strAliasPrefix . 'email_on_assigned_min_severity';
			$objToReturn->intEmailOnAssignedMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_on_new_min_severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_on_new_min_severity'] : $strAliasPrefix . 'email_on_new_min_severity';
			$objToReturn->intEmailOnNewMinSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'email_bugnote_limit', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_bugnote_limit'] : $strAliasPrefix . 'email_bugnote_limit';
			$objToReturn->intEmailBugnoteLimit = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'language', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'language'] : $strAliasPrefix . 'language';
			$objToReturn->strLanguage = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'timezone', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'timezone'] : $strAliasPrefix . 'timezone';
			$objToReturn->strTimezone = $objDbRow->GetColumn($strAliasName, 'VarChar');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'mantis_user_pref_table__';




			return $objToReturn;
		}

		/**
		 * Instantiate an array of MantisUserPrefTables from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return MantisUserPrefTable[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();

			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = MantisUserPrefTable::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = MantisUserPrefTable::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single MantisUserPrefTable object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisUserPrefTable
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return MantisUserPrefTable::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::MantisUserPrefTable()->Id, $intId)
				),
				$objOptionalClauses
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this MantisUserPrefTable
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = MantisUserPrefTable::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `mantis_user_pref_table` (
							`user_id`,
							`project_id`,
							`default_profile`,
							`default_project`,
							`refresh_delay`,
							`redirect_delay`,
							`bugnote_order`,
							`email_on_new`,
							`email_on_assigned`,
							`email_on_feedback`,
							`email_on_resolved`,
							`email_on_closed`,
							`email_on_reopened`,
							`email_on_bugnote`,
							`email_on_status`,
							`email_on_priority`,
							`email_on_priority_min_severity`,
							`email_on_status_min_severity`,
							`email_on_bugnote_min_severity`,
							`email_on_reopened_min_severity`,
							`email_on_closed_min_severity`,
							`email_on_resolved_min_severity`,
							`email_on_feedback_min_severity`,
							`email_on_assigned_min_severity`,
							`email_on_new_min_severity`,
							`email_bugnote_limit`,
							`language`,
							`timezone`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserId) . ',
							' . $objDatabase->SqlVariable($this->intProjectId) . ',
							' . $objDatabase->SqlVariable($this->intDefaultProfile) . ',
							' . $objDatabase->SqlVariable($this->intDefaultProject) . ',
							' . $objDatabase->SqlVariable($this->intRefreshDelay) . ',
							' . $objDatabase->SqlVariable($this->intRedirectDelay) . ',
							' . $objDatabase->SqlVariable($this->strBugnoteOrder) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnNew) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnAssigned) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnFeedback) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnResolved) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnClosed) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnReopened) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnBugnote) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnStatus) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnPriority) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnPriorityMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnStatusMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnBugnoteMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnReopenedMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnClosedMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnResolvedMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnFeedbackMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnAssignedMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailOnNewMinSeverity) . ',
							' . $objDatabase->SqlVariable($this->intEmailBugnoteLimit) . ',
							' . $objDatabase->SqlVariable($this->strLanguage) . ',
							' . $objDatabase->SqlVariable($this->strTimezone) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('mantis_user_pref_table', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`mantis_user_pref_table`
						SET
							`user_id` = ' . $objDatabase->SqlVariable($this->intUserId) . ',
							`project_id` = ' . $objDatabase->SqlVariable($this->intProjectId) . ',
							`default_profile` = ' . $objDatabase->SqlVariable($this->intDefaultProfile) . ',
							`default_project` = ' . $objDatabase->SqlVariable($this->intDefaultProject) . ',
							`refresh_delay` = ' . $objDatabase->SqlVariable($this->intRefreshDelay) . ',
							`redirect_delay` = ' . $objDatabase->SqlVariable($this->intRedirectDelay) . ',
							`bugnote_order` = ' . $objDatabase->SqlVariable($this->strBugnoteOrder) . ',
							`email_on_new` = ' . $objDatabase->SqlVariable($this->intEmailOnNew) . ',
							`email_on_assigned` = ' . $objDatabase->SqlVariable($this->intEmailOnAssigned) . ',
							`email_on_feedback` = ' . $objDatabase->SqlVariable($this->intEmailOnFeedback) . ',
							`email_on_resolved` = ' . $objDatabase->SqlVariable($this->intEmailOnResolved) . ',
							`email_on_closed` = ' . $objDatabase->SqlVariable($this->intEmailOnClosed) . ',
							`email_on_reopened` = ' . $objDatabase->SqlVariable($this->intEmailOnReopened) . ',
							`email_on_bugnote` = ' . $objDatabase->SqlVariable($this->intEmailOnBugnote) . ',
							`email_on_status` = ' . $objDatabase->SqlVariable($this->intEmailOnStatus) . ',
							`email_on_priority` = ' . $objDatabase->SqlVariable($this->intEmailOnPriority) . ',
							`email_on_priority_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnPriorityMinSeverity) . ',
							`email_on_status_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnStatusMinSeverity) . ',
							`email_on_bugnote_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnBugnoteMinSeverity) . ',
							`email_on_reopened_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnReopenedMinSeverity) . ',
							`email_on_closed_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnClosedMinSeverity) . ',
							`email_on_resolved_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnResolvedMinSeverity) . ',
							`email_on_feedback_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnFeedbackMinSeverity) . ',
							`email_on_assigned_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnAssignedMinSeverity) . ',
							`email_on_new_min_severity` = ' . $objDatabase->SqlVariable($this->intEmailOnNewMinSeverity) . ',
							`email_bugnote_limit` = ' . $objDatabase->SqlVariable($this->intEmailBugnoteLimit) . ',
							`language` = ' . $objDatabase->SqlVariable($this->strLanguage) . ',
							`timezone` = ' . $objDatabase->SqlVariable($this->strTimezone) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return
			return $mixToReturn;
		}

		/**
		 * Delete this MantisUserPrefTable
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this MantisUserPrefTable with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = MantisUserPrefTable::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`mantis_user_pref_table`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all MantisUserPrefTables
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = MantisUserPrefTable::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`mantis_user_pref_table`');
		}

		/**
		 * Truncate mantis_user_pref_table table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = MantisUserPrefTable::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `mantis_user_pref_table`');
		}

		/**
		 * Reload this MantisUserPrefTable from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved MantisUserPrefTable object.');

			// Reload the Object
			$objReloaded = MantisUserPrefTable::Load($this->intId);

			// Update $this's local variables to match
			$this->intUserId = $objReloaded->intUserId;
			$this->intProjectId = $objReloaded->intProjectId;
			$this->intDefaultProfile = $objReloaded->intDefaultProfile;
			$this->intDefaultProject = $objReloaded->intDefaultProject;
			$this->intRefreshDelay = $objReloaded->intRefreshDelay;
			$this->intRedirectDelay = $objReloaded->intRedirectDelay;
			$this->strBugnoteOrder = $objReloaded->strBugnoteOrder;
			$this->intEmailOnNew = $objReloaded->intEmailOnNew;
			$this->intEmailOnAssigned = $objReloaded->intEmailOnAssigned;
			$this->intEmailOnFeedback = $objReloaded->intEmailOnFeedback;
			$this->intEmailOnResolved = $objReloaded->intEmailOnResolved;
			$this->intEmailOnClosed = $objReloaded->intEmailOnClosed;
			$this->intEmailOnReopened = $objReloaded->intEmailOnReopened;
			$this->intEmailOnBugnote = $objReloaded->intEmailOnBugnote;
			$this->intEmailOnStatus = $objReloaded->intEmailOnStatus;
			$this->intEmailOnPriority = $objReloaded->intEmailOnPriority;
			$this->intEmailOnPriorityMinSeverity = $objReloaded->intEmailOnPriorityMinSeverity;
			$this->intEmailOnStatusMinSeverity = $objReloaded->intEmailOnStatusMinSeverity;
			$this->intEmailOnBugnoteMinSeverity = $objReloaded->intEmailOnBugnoteMinSeverity;
			$this->intEmailOnReopenedMinSeverity = $objReloaded->intEmailOnReopenedMinSeverity;
			$this->intEmailOnClosedMinSeverity = $objReloaded->intEmailOnClosedMinSeverity;
			$this->intEmailOnResolvedMinSeverity = $objReloaded->intEmailOnResolvedMinSeverity;
			$this->intEmailOnFeedbackMinSeverity = $objReloaded->intEmailOnFeedbackMinSeverity;
			$this->intEmailOnAssignedMinSeverity = $objReloaded->intEmailOnAssignedMinSeverity;
			$this->intEmailOnNewMinSeverity = $objReloaded->intEmailOnNewMinSeverity;
			$this->intEmailBugnoteLimit = $objReloaded->intEmailBugnoteLimit;
			$this->strLanguage = $objReloaded->strLanguage;
			$this->strTimezone = $objReloaded->strTimezone;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserId':
					/**
					 * Gets the value for intUserId (Not Null)
					 * @return integer
					 */
					return $this->intUserId;

				case 'ProjectId':
					/**
					 * Gets the value for intProjectId (Not Null)
					 * @return integer
					 */
					return $this->intProjectId;

				case 'DefaultProfile':
					/**
					 * Gets the value for intDefaultProfile (Not Null)
					 * @return integer
					 */
					return $this->intDefaultProfile;

				case 'DefaultProject':
					/**
					 * Gets the value for intDefaultProject (Not Null)
					 * @return integer
					 */
					return $this->intDefaultProject;

				case 'RefreshDelay':
					/**
					 * Gets the value for intRefreshDelay (Not Null)
					 * @return integer
					 */
					return $this->intRefreshDelay;

				case 'RedirectDelay':
					/**
					 * Gets the value for intRedirectDelay (Not Null)
					 * @return integer
					 */
					return $this->intRedirectDelay;

				case 'BugnoteOrder':
					/**
					 * Gets the value for strBugnoteOrder (Not Null)
					 * @return string
					 */
					return $this->strBugnoteOrder;

				case 'EmailOnNew':
					/**
					 * Gets the value for intEmailOnNew (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnNew;

				case 'EmailOnAssigned':
					/**
					 * Gets the value for intEmailOnAssigned (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnAssigned;

				case 'EmailOnFeedback':
					/**
					 * Gets the value for intEmailOnFeedback (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnFeedback;

				case 'EmailOnResolved':
					/**
					 * Gets the value for intEmailOnResolved (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnResolved;

				case 'EmailOnClosed':
					/**
					 * Gets the value for intEmailOnClosed (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnClosed;

				case 'EmailOnReopened':
					/**
					 * Gets the value for intEmailOnReopened (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnReopened;

				case 'EmailOnBugnote':
					/**
					 * Gets the value for intEmailOnBugnote (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnBugnote;

				case 'EmailOnStatus':
					/**
					 * Gets the value for intEmailOnStatus (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnStatus;

				case 'EmailOnPriority':
					/**
					 * Gets the value for intEmailOnPriority (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnPriority;

				case 'EmailOnPriorityMinSeverity':
					/**
					 * Gets the value for intEmailOnPriorityMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnPriorityMinSeverity;

				case 'EmailOnStatusMinSeverity':
					/**
					 * Gets the value for intEmailOnStatusMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnStatusMinSeverity;

				case 'EmailOnBugnoteMinSeverity':
					/**
					 * Gets the value for intEmailOnBugnoteMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnBugnoteMinSeverity;

				case 'EmailOnReopenedMinSeverity':
					/**
					 * Gets the value for intEmailOnReopenedMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnReopenedMinSeverity;

				case 'EmailOnClosedMinSeverity':
					/**
					 * Gets the value for intEmailOnClosedMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnClosedMinSeverity;

				case 'EmailOnResolvedMinSeverity':
					/**
					 * Gets the value for intEmailOnResolvedMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnResolvedMinSeverity;

				case 'EmailOnFeedbackMinSeverity':
					/**
					 * Gets the value for intEmailOnFeedbackMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnFeedbackMinSeverity;

				case 'EmailOnAssignedMinSeverity':
					/**
					 * Gets the value for intEmailOnAssignedMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnAssignedMinSeverity;

				case 'EmailOnNewMinSeverity':
					/**
					 * Gets the value for intEmailOnNewMinSeverity (Not Null)
					 * @return integer
					 */
					return $this->intEmailOnNewMinSeverity;

				case 'EmailBugnoteLimit':
					/**
					 * Gets the value for intEmailBugnoteLimit (Not Null)
					 * @return integer
					 */
					return $this->intEmailBugnoteLimit;

				case 'Language':
					/**
					 * Gets the value for strLanguage (Not Null)
					 * @return string
					 */
					return $this->strLanguage;

				case 'Timezone':
					/**
					 * Gets the value for strTimezone (Not Null)
					 * @return string
					 */
					return $this->strTimezone;


				///////////////////
				// Member Objects
				///////////////////

				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserId':
					/**
					 * Sets the value for intUserId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProjectId':
					/**
					 * Sets the value for intProjectId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intProjectId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DefaultProfile':
					/**
					 * Sets the value for intDefaultProfile (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDefaultProfile = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DefaultProject':
					/**
					 * Sets the value for intDefaultProject (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDefaultProject = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RefreshDelay':
					/**
					 * Sets the value for intRefreshDelay (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intRefreshDelay = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RedirectDelay':
					/**
					 * Sets the value for intRedirectDelay (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intRedirectDelay = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'BugnoteOrder':
					/**
					 * Sets the value for strBugnoteOrder (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strBugnoteOrder = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnNew':
					/**
					 * Sets the value for intEmailOnNew (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnNew = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnAssigned':
					/**
					 * Sets the value for intEmailOnAssigned (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnAssigned = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnFeedback':
					/**
					 * Sets the value for intEmailOnFeedback (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnFeedback = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnResolved':
					/**
					 * Sets the value for intEmailOnResolved (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnResolved = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnClosed':
					/**
					 * Sets the value for intEmailOnClosed (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnClosed = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnReopened':
					/**
					 * Sets the value for intEmailOnReopened (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnReopened = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnBugnote':
					/**
					 * Sets the value for intEmailOnBugnote (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnBugnote = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnStatus':
					/**
					 * Sets the value for intEmailOnStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnPriority':
					/**
					 * Sets the value for intEmailOnPriority (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnPriority = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnPriorityMinSeverity':
					/**
					 * Sets the value for intEmailOnPriorityMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnPriorityMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnStatusMinSeverity':
					/**
					 * Sets the value for intEmailOnStatusMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnStatusMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnBugnoteMinSeverity':
					/**
					 * Sets the value for intEmailOnBugnoteMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnBugnoteMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnReopenedMinSeverity':
					/**
					 * Sets the value for intEmailOnReopenedMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnReopenedMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnClosedMinSeverity':
					/**
					 * Sets the value for intEmailOnClosedMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnClosedMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnResolvedMinSeverity':
					/**
					 * Sets the value for intEmailOnResolvedMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnResolvedMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnFeedbackMinSeverity':
					/**
					 * Sets the value for intEmailOnFeedbackMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnFeedbackMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnAssignedMinSeverity':
					/**
					 * Sets the value for intEmailOnAssignedMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnAssignedMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailOnNewMinSeverity':
					/**
					 * Sets the value for intEmailOnNewMinSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailOnNewMinSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EmailBugnoteLimit':
					/**
					 * Sets the value for intEmailBugnoteLimit (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEmailBugnoteLimit = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Language':
					/**
					 * Sets the value for strLanguage (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strLanguage = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Timezone':
					/**
					 * Sets the value for strTimezone (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTimezone = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="MantisUserPrefTable"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="UserId" type="xsd:int"/>';
			$strToReturn .= '<element name="ProjectId" type="xsd:int"/>';
			$strToReturn .= '<element name="DefaultProfile" type="xsd:int"/>';
			$strToReturn .= '<element name="DefaultProject" type="xsd:int"/>';
			$strToReturn .= '<element name="RefreshDelay" type="xsd:int"/>';
			$strToReturn .= '<element name="RedirectDelay" type="xsd:int"/>';
			$strToReturn .= '<element name="BugnoteOrder" type="xsd:string"/>';
			$strToReturn .= '<element name="EmailOnNew" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnAssigned" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnFeedback" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnResolved" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnClosed" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnReopened" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnBugnote" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnStatus" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnPriority" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnPriorityMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnStatusMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnBugnoteMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnReopenedMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnClosedMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnResolvedMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnFeedbackMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnAssignedMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailOnNewMinSeverity" type="xsd:int"/>';
			$strToReturn .= '<element name="EmailBugnoteLimit" type="xsd:int"/>';
			$strToReturn .= '<element name="Language" type="xsd:string"/>';
			$strToReturn .= '<element name="Timezone" type="xsd:string"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('MantisUserPrefTable', $strComplexTypeArray)) {
				$strComplexTypeArray['MantisUserPrefTable'] = MantisUserPrefTable::GetSoapComplexTypeXml();
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, MantisUserPrefTable::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new MantisUserPrefTable();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if (property_exists($objSoapObject, 'UserId'))
				$objToReturn->intUserId = $objSoapObject->UserId;
			if (property_exists($objSoapObject, 'ProjectId'))
				$objToReturn->intProjectId = $objSoapObject->ProjectId;
			if (property_exists($objSoapObject, 'DefaultProfile'))
				$objToReturn->intDefaultProfile = $objSoapObject->DefaultProfile;
			if (property_exists($objSoapObject, 'DefaultProject'))
				$objToReturn->intDefaultProject = $objSoapObject->DefaultProject;
			if (property_exists($objSoapObject, 'RefreshDelay'))
				$objToReturn->intRefreshDelay = $objSoapObject->RefreshDelay;
			if (property_exists($objSoapObject, 'RedirectDelay'))
				$objToReturn->intRedirectDelay = $objSoapObject->RedirectDelay;
			if (property_exists($objSoapObject, 'BugnoteOrder'))
				$objToReturn->strBugnoteOrder = $objSoapObject->BugnoteOrder;
			if (property_exists($objSoapObject, 'EmailOnNew'))
				$objToReturn->intEmailOnNew = $objSoapObject->EmailOnNew;
			if (property_exists($objSoapObject, 'EmailOnAssigned'))
				$objToReturn->intEmailOnAssigned = $objSoapObject->EmailOnAssigned;
			if (property_exists($objSoapObject, 'EmailOnFeedback'))
				$objToReturn->intEmailOnFeedback = $objSoapObject->EmailOnFeedback;
			if (property_exists($objSoapObject, 'EmailOnResolved'))
				$objToReturn->intEmailOnResolved = $objSoapObject->EmailOnResolved;
			if (property_exists($objSoapObject, 'EmailOnClosed'))
				$objToReturn->intEmailOnClosed = $objSoapObject->EmailOnClosed;
			if (property_exists($objSoapObject, 'EmailOnReopened'))
				$objToReturn->intEmailOnReopened = $objSoapObject->EmailOnReopened;
			if (property_exists($objSoapObject, 'EmailOnBugnote'))
				$objToReturn->intEmailOnBugnote = $objSoapObject->EmailOnBugnote;
			if (property_exists($objSoapObject, 'EmailOnStatus'))
				$objToReturn->intEmailOnStatus = $objSoapObject->EmailOnStatus;
			if (property_exists($objSoapObject, 'EmailOnPriority'))
				$objToReturn->intEmailOnPriority = $objSoapObject->EmailOnPriority;
			if (property_exists($objSoapObject, 'EmailOnPriorityMinSeverity'))
				$objToReturn->intEmailOnPriorityMinSeverity = $objSoapObject->EmailOnPriorityMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnStatusMinSeverity'))
				$objToReturn->intEmailOnStatusMinSeverity = $objSoapObject->EmailOnStatusMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnBugnoteMinSeverity'))
				$objToReturn->intEmailOnBugnoteMinSeverity = $objSoapObject->EmailOnBugnoteMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnReopenedMinSeverity'))
				$objToReturn->intEmailOnReopenedMinSeverity = $objSoapObject->EmailOnReopenedMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnClosedMinSeverity'))
				$objToReturn->intEmailOnClosedMinSeverity = $objSoapObject->EmailOnClosedMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnResolvedMinSeverity'))
				$objToReturn->intEmailOnResolvedMinSeverity = $objSoapObject->EmailOnResolvedMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnFeedbackMinSeverity'))
				$objToReturn->intEmailOnFeedbackMinSeverity = $objSoapObject->EmailOnFeedbackMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnAssignedMinSeverity'))
				$objToReturn->intEmailOnAssignedMinSeverity = $objSoapObject->EmailOnAssignedMinSeverity;
			if (property_exists($objSoapObject, 'EmailOnNewMinSeverity'))
				$objToReturn->intEmailOnNewMinSeverity = $objSoapObject->EmailOnNewMinSeverity;
			if (property_exists($objSoapObject, 'EmailBugnoteLimit'))
				$objToReturn->intEmailBugnoteLimit = $objSoapObject->EmailBugnoteLimit;
			if (property_exists($objSoapObject, 'Language'))
				$objToReturn->strLanguage = $objSoapObject->Language;
			if (property_exists($objSoapObject, 'Timezone'))
				$objToReturn->strTimezone = $objSoapObject->Timezone;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, MantisUserPrefTable::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			return $objObject;
		}


		////////////////////////////////////////
		// METHODS for JSON Object Translation
		////////////////////////////////////////

		// this function is required for objects that implement the
		// IteratorAggregate interface
		public function getIterator() {
			///////////////////
			// Member Variables
			///////////////////
			$iArray['Id'] = $this->intId;
			$iArray['UserId'] = $this->intUserId;
			$iArray['ProjectId'] = $this->intProjectId;
			$iArray['DefaultProfile'] = $this->intDefaultProfile;
			$iArray['DefaultProject'] = $this->intDefaultProject;
			$iArray['RefreshDelay'] = $this->intRefreshDelay;
			$iArray['RedirectDelay'] = $this->intRedirectDelay;
			$iArray['BugnoteOrder'] = $this->strBugnoteOrder;
			$iArray['EmailOnNew'] = $this->intEmailOnNew;
			$iArray['EmailOnAssigned'] = $this->intEmailOnAssigned;
			$iArray['EmailOnFeedback'] = $this->intEmailOnFeedback;
			$iArray['EmailOnResolved'] = $this->intEmailOnResolved;
			$iArray['EmailOnClosed'] = $this->intEmailOnClosed;
			$iArray['EmailOnReopened'] = $this->intEmailOnReopened;
			$iArray['EmailOnBugnote'] = $this->intEmailOnBugnote;
			$iArray['EmailOnStatus'] = $this->intEmailOnStatus;
			$iArray['EmailOnPriority'] = $this->intEmailOnPriority;
			$iArray['EmailOnPriorityMinSeverity'] = $this->intEmailOnPriorityMinSeverity;
			$iArray['EmailOnStatusMinSeverity'] = $this->intEmailOnStatusMinSeverity;
			$iArray['EmailOnBugnoteMinSeverity'] = $this->intEmailOnBugnoteMinSeverity;
			$iArray['EmailOnReopenedMinSeverity'] = $this->intEmailOnReopenedMinSeverity;
			$iArray['EmailOnClosedMinSeverity'] = $this->intEmailOnClosedMinSeverity;
			$iArray['EmailOnResolvedMinSeverity'] = $this->intEmailOnResolvedMinSeverity;
			$iArray['EmailOnFeedbackMinSeverity'] = $this->intEmailOnFeedbackMinSeverity;
			$iArray['EmailOnAssignedMinSeverity'] = $this->intEmailOnAssignedMinSeverity;
			$iArray['EmailOnNewMinSeverity'] = $this->intEmailOnNewMinSeverity;
			$iArray['EmailBugnoteLimit'] = $this->intEmailBugnoteLimit;
			$iArray['Language'] = $this->strLanguage;
			$iArray['Timezone'] = $this->strTimezone;
			return new ArrayIterator($iArray);
		}

		// this function returns a Json formatted string using the
		// IteratorAggregate interface
		public function getJson() {
			return json_encode($this->getIterator());
		}


	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

    /**
     * @uses QQNode
     *
     * @property-read QQNode $Id
     * @property-read QQNode $UserId
     * @property-read QQNode $ProjectId
     * @property-read QQNode $DefaultProfile
     * @property-read QQNode $DefaultProject
     * @property-read QQNode $RefreshDelay
     * @property-read QQNode $RedirectDelay
     * @property-read QQNode $BugnoteOrder
     * @property-read QQNode $EmailOnNew
     * @property-read QQNode $EmailOnAssigned
     * @property-read QQNode $EmailOnFeedback
     * @property-read QQNode $EmailOnResolved
     * @property-read QQNode $EmailOnClosed
     * @property-read QQNode $EmailOnReopened
     * @property-read QQNode $EmailOnBugnote
     * @property-read QQNode $EmailOnStatus
     * @property-read QQNode $EmailOnPriority
     * @property-read QQNode $EmailOnPriorityMinSeverity
     * @property-read QQNode $EmailOnStatusMinSeverity
     * @property-read QQNode $EmailOnBugnoteMinSeverity
     * @property-read QQNode $EmailOnReopenedMinSeverity
     * @property-read QQNode $EmailOnClosedMinSeverity
     * @property-read QQNode $EmailOnResolvedMinSeverity
     * @property-read QQNode $EmailOnFeedbackMinSeverity
     * @property-read QQNode $EmailOnAssignedMinSeverity
     * @property-read QQNode $EmailOnNewMinSeverity
     * @property-read QQNode $EmailBugnoteLimit
     * @property-read QQNode $Language
     * @property-read QQNode $Timezone
     *
     *

     * @property-read QQNode $_PrimaryKeyNode
     **/
	class QQNodeMantisUserPrefTable extends QQNode {
		protected $strTableName = 'mantis_user_pref_table';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'MantisUserPrefTable';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'Integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'Integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'Integer', $this);
				case 'DefaultProfile':
					return new QQNode('default_profile', 'DefaultProfile', 'Integer', $this);
				case 'DefaultProject':
					return new QQNode('default_project', 'DefaultProject', 'Integer', $this);
				case 'RefreshDelay':
					return new QQNode('refresh_delay', 'RefreshDelay', 'Integer', $this);
				case 'RedirectDelay':
					return new QQNode('redirect_delay', 'RedirectDelay', 'Integer', $this);
				case 'BugnoteOrder':
					return new QQNode('bugnote_order', 'BugnoteOrder', 'VarChar', $this);
				case 'EmailOnNew':
					return new QQNode('email_on_new', 'EmailOnNew', 'Integer', $this);
				case 'EmailOnAssigned':
					return new QQNode('email_on_assigned', 'EmailOnAssigned', 'Integer', $this);
				case 'EmailOnFeedback':
					return new QQNode('email_on_feedback', 'EmailOnFeedback', 'Integer', $this);
				case 'EmailOnResolved':
					return new QQNode('email_on_resolved', 'EmailOnResolved', 'Integer', $this);
				case 'EmailOnClosed':
					return new QQNode('email_on_closed', 'EmailOnClosed', 'Integer', $this);
				case 'EmailOnReopened':
					return new QQNode('email_on_reopened', 'EmailOnReopened', 'Integer', $this);
				case 'EmailOnBugnote':
					return new QQNode('email_on_bugnote', 'EmailOnBugnote', 'Integer', $this);
				case 'EmailOnStatus':
					return new QQNode('email_on_status', 'EmailOnStatus', 'Integer', $this);
				case 'EmailOnPriority':
					return new QQNode('email_on_priority', 'EmailOnPriority', 'Integer', $this);
				case 'EmailOnPriorityMinSeverity':
					return new QQNode('email_on_priority_min_severity', 'EmailOnPriorityMinSeverity', 'Integer', $this);
				case 'EmailOnStatusMinSeverity':
					return new QQNode('email_on_status_min_severity', 'EmailOnStatusMinSeverity', 'Integer', $this);
				case 'EmailOnBugnoteMinSeverity':
					return new QQNode('email_on_bugnote_min_severity', 'EmailOnBugnoteMinSeverity', 'Integer', $this);
				case 'EmailOnReopenedMinSeverity':
					return new QQNode('email_on_reopened_min_severity', 'EmailOnReopenedMinSeverity', 'Integer', $this);
				case 'EmailOnClosedMinSeverity':
					return new QQNode('email_on_closed_min_severity', 'EmailOnClosedMinSeverity', 'Integer', $this);
				case 'EmailOnResolvedMinSeverity':
					return new QQNode('email_on_resolved_min_severity', 'EmailOnResolvedMinSeverity', 'Integer', $this);
				case 'EmailOnFeedbackMinSeverity':
					return new QQNode('email_on_feedback_min_severity', 'EmailOnFeedbackMinSeverity', 'Integer', $this);
				case 'EmailOnAssignedMinSeverity':
					return new QQNode('email_on_assigned_min_severity', 'EmailOnAssignedMinSeverity', 'Integer', $this);
				case 'EmailOnNewMinSeverity':
					return new QQNode('email_on_new_min_severity', 'EmailOnNewMinSeverity', 'Integer', $this);
				case 'EmailBugnoteLimit':
					return new QQNode('email_bugnote_limit', 'EmailBugnoteLimit', 'Integer', $this);
				case 'Language':
					return new QQNode('language', 'Language', 'VarChar', $this);
				case 'Timezone':
					return new QQNode('timezone', 'Timezone', 'VarChar', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'Integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

    /**
     * @property-read QQNode $Id
     * @property-read QQNode $UserId
     * @property-read QQNode $ProjectId
     * @property-read QQNode $DefaultProfile
     * @property-read QQNode $DefaultProject
     * @property-read QQNode $RefreshDelay
     * @property-read QQNode $RedirectDelay
     * @property-read QQNode $BugnoteOrder
     * @property-read QQNode $EmailOnNew
     * @property-read QQNode $EmailOnAssigned
     * @property-read QQNode $EmailOnFeedback
     * @property-read QQNode $EmailOnResolved
     * @property-read QQNode $EmailOnClosed
     * @property-read QQNode $EmailOnReopened
     * @property-read QQNode $EmailOnBugnote
     * @property-read QQNode $EmailOnStatus
     * @property-read QQNode $EmailOnPriority
     * @property-read QQNode $EmailOnPriorityMinSeverity
     * @property-read QQNode $EmailOnStatusMinSeverity
     * @property-read QQNode $EmailOnBugnoteMinSeverity
     * @property-read QQNode $EmailOnReopenedMinSeverity
     * @property-read QQNode $EmailOnClosedMinSeverity
     * @property-read QQNode $EmailOnResolvedMinSeverity
     * @property-read QQNode $EmailOnFeedbackMinSeverity
     * @property-read QQNode $EmailOnAssignedMinSeverity
     * @property-read QQNode $EmailOnNewMinSeverity
     * @property-read QQNode $EmailBugnoteLimit
     * @property-read QQNode $Language
     * @property-read QQNode $Timezone
     *
     *

     * @property-read QQNode $_PrimaryKeyNode
     **/
	class QQReverseReferenceNodeMantisUserPrefTable extends QQReverseReferenceNode {
		protected $strTableName = 'mantis_user_pref_table';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'MantisUserPrefTable';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'DefaultProfile':
					return new QQNode('default_profile', 'DefaultProfile', 'integer', $this);
				case 'DefaultProject':
					return new QQNode('default_project', 'DefaultProject', 'integer', $this);
				case 'RefreshDelay':
					return new QQNode('refresh_delay', 'RefreshDelay', 'integer', $this);
				case 'RedirectDelay':
					return new QQNode('redirect_delay', 'RedirectDelay', 'integer', $this);
				case 'BugnoteOrder':
					return new QQNode('bugnote_order', 'BugnoteOrder', 'string', $this);
				case 'EmailOnNew':
					return new QQNode('email_on_new', 'EmailOnNew', 'integer', $this);
				case 'EmailOnAssigned':
					return new QQNode('email_on_assigned', 'EmailOnAssigned', 'integer', $this);
				case 'EmailOnFeedback':
					return new QQNode('email_on_feedback', 'EmailOnFeedback', 'integer', $this);
				case 'EmailOnResolved':
					return new QQNode('email_on_resolved', 'EmailOnResolved', 'integer', $this);
				case 'EmailOnClosed':
					return new QQNode('email_on_closed', 'EmailOnClosed', 'integer', $this);
				case 'EmailOnReopened':
					return new QQNode('email_on_reopened', 'EmailOnReopened', 'integer', $this);
				case 'EmailOnBugnote':
					return new QQNode('email_on_bugnote', 'EmailOnBugnote', 'integer', $this);
				case 'EmailOnStatus':
					return new QQNode('email_on_status', 'EmailOnStatus', 'integer', $this);
				case 'EmailOnPriority':
					return new QQNode('email_on_priority', 'EmailOnPriority', 'integer', $this);
				case 'EmailOnPriorityMinSeverity':
					return new QQNode('email_on_priority_min_severity', 'EmailOnPriorityMinSeverity', 'integer', $this);
				case 'EmailOnStatusMinSeverity':
					return new QQNode('email_on_status_min_severity', 'EmailOnStatusMinSeverity', 'integer', $this);
				case 'EmailOnBugnoteMinSeverity':
					return new QQNode('email_on_bugnote_min_severity', 'EmailOnBugnoteMinSeverity', 'integer', $this);
				case 'EmailOnReopenedMinSeverity':
					return new QQNode('email_on_reopened_min_severity', 'EmailOnReopenedMinSeverity', 'integer', $this);
				case 'EmailOnClosedMinSeverity':
					return new QQNode('email_on_closed_min_severity', 'EmailOnClosedMinSeverity', 'integer', $this);
				case 'EmailOnResolvedMinSeverity':
					return new QQNode('email_on_resolved_min_severity', 'EmailOnResolvedMinSeverity', 'integer', $this);
				case 'EmailOnFeedbackMinSeverity':
					return new QQNode('email_on_feedback_min_severity', 'EmailOnFeedbackMinSeverity', 'integer', $this);
				case 'EmailOnAssignedMinSeverity':
					return new QQNode('email_on_assigned_min_severity', 'EmailOnAssignedMinSeverity', 'integer', $this);
				case 'EmailOnNewMinSeverity':
					return new QQNode('email_on_new_min_severity', 'EmailOnNewMinSeverity', 'integer', $this);
				case 'EmailBugnoteLimit':
					return new QQNode('email_bugnote_limit', 'EmailBugnoteLimit', 'integer', $this);
				case 'Language':
					return new QQNode('language', 'Language', 'string', $this);
				case 'Timezone':
					return new QQNode('timezone', 'Timezone', 'string', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>
